<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Do
 * Date: 11/11/13
 * Time: 12:26 PM
 * To change this template use File | Settings | File Templates.
 */
?>

<link href="<?php echo base_url(); ?>public/admin/css/group.css" rel="stylesheet" type="text/css">
<div class="page-content">
    <div class="page-header position-relative">
        <h1>
            Nhóm thành viên.
        </h1>
    </div>
    <div  id="group_table">
        <div id="sample-table-2_wrapper" class="dataTables_wrapper" role="grid">
            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                <thead>
                <tr>
                    <th class="center">
                        <label>
                            <input type="checkbox">
                            <span class="lbl"></span>
                        </label>
                    </th>
                    <th>Mã số</th>
                    <th class="hidden-480">Tên nhóm</th>
                    <th>Mô tả</th>
                    <th>Tùy chỉnh</th>
                </tr>
                </thead>

                <tbody>
                <?php
                foreach($group as $value){
                    ?>
                    <tr class="">
                        <td class="center">
                            <label>
                                <input type="checkbox">
                                <span class="lbl"></span>
                            </label>
                        </td>
                        <td><?php echo $value['GroupId']; ?></td>
                        <td>
                            <a gid="<?php echo $value['GroupId']; ?>" href="<?php echo base_url()."admin/management/".$value['GroupId']; ?>"><?php echo $value['GroupName']; ?></a>
                        </td>
                        <td class="hidden-480">
                            <?php echo $value['Description']; ?>
                        </td>
                        <td>
                            <div class="hidden-phone visible-desktop btn-group">
                                <button gid="<?php echo $value['GroupId']; ?>" onclick="deleteGroup(this)" class="btn btn-mini btn-danger">
                                    <i class="icon-trash bigger-120"></i>
                                </button>
                            </div>
                        </td>
                    </tr>
                <?php
                }
                ?>
                </tbody>
            </table>
        </div>

    </div>
</div>
<script>
    function deleteGroup(obj){
        obj = $(obj);
        id = obj.attr('gid');
        $.ajax({
            type:"POST",
            url:"<?php echo base_url(); ?>admin/deleteGroup",
            dataType:"json",
            data:{'id':id},
            success:(function(data){
                if(data.status == "ok"){

                }
            })
        });
    }

</script>